package com.songlanyun.modules.opus.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import java.util.Date;

import com.songlanyun.common.drive.RootEntity;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;

/**
 * 作品主题表
 *
 * @author lubo
 * @email sunlightcs@gmail.com
 * @date 2021-01-13 16:35:02
 */
@Data
@TableName("yxt_opus_theme_system")
public class OpusThemeSystem extends RootEntity<Long, OpusThemeSystem> implements Serializable {
    private static final long serialVersionUID = 1L;

    {
        commentNum = 0L;
        likeNum = 0L;
		stick = false;
		open = true;
		orderIndex = 0;

    }
    /**
     *
     */
    @TableId
    private Long id;
    /**
     * 主题
     */
	@NotBlank(message = "主题名称不能为空")
	@Length(min = 1, max = 30, message = "主题名称长度在1-30个字")
	private String title;
    /**
     * 作品数
     */
    @TableField(exist = false)
    private Integer opusNum;
    /**
     * 评论数
     */
    private Long commentNum;
    /**
     * 点赞数
     */
    private Long likeNum;
    /**
     * 是否置顶
     */
    private Boolean stick;
    /**
     * 是否显示
     */
    private Boolean open;
    /**
     * 封面
     */
    private String cover;
    /**
     * 顺序（从小到大排序）
     */
	@Min(value = 0, message = "顺序最小是零")
	@Max(value = 99999999, message = "顺序最大是99999999")
	private Integer orderIndex;
    /**
     * 创建 时间
     */
	@TableField(fill = FieldFill.INSERT)
    private Date createTime;

    @Override
    public Long getIdentity() {
        return getId();
    }
}
